package a.j;

import a.c.z;
import a.d.o;
import a.d.s;
import a.d.w;
import a.d.x;
import a.d.y;
import a.e.b.c.eb;
import a.f.fc;
import a.f.wb;
import a.f.wc;
import a.f.xb;
import a.f.zb;
import a.f.zc;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import a.c.z;

public class bb
  implements xb
{
  private double a = 0.0D;
  private double b = 0.5D;
  private double c = 0.5D;
  private double d;
  private double e = 0.0D;
  private double f = 1.0D;
  public static int g;
  
  public double b()
  {
    return this.f;
  }
  
  public void a(double paramDouble)
  {
    this.f = paramDouble;
  }
  
  public double c()
  {
    return this.d;
  }
  
  public void b(double paramDouble)
  {
    this.d = paramDouble;
  }
  
  public double d()
  {
    return this.b;
  }
  
  public void c(double paramDouble)
  {
    this.b = paramDouble;
  }
  
  public double e()
  {
    return this.c;
  }
  
  public void d(double paramDouble)
  {
    this.c = paramDouble;
  }
  
  public double f()
  {
    return this.a;
  }
  
  public void e(double paramDouble)
  {
    this.a = paramDouble;
  }
  
  public Object a()
  {
    return new b_(0.5D, -1);
  }
  
  public o a(s params, zb paramzb, zc paramzc1, zc paramzc2, Object paramObject)
  {
    if (!ld.E) {
      if (!(paramObject instanceof b_)) {
        paramObject = a();
      }
    }
    b_ localb_ = (b_)paramObject;
    c_ localc_ = new c_(null);
    a(paramzb, paramzc1, paramzc2, localb_, localc_);
    return a(params.a, params.b, localc_);
  }
  
  private o a(double paramDouble1, double paramDouble2, c_ paramc_)
  {
    double d1 = paramc_.e + c();
    double d2 = Math.sin(d1);
    double d3 = -Math.cos(d1);
    double d4 = paramDouble2 * (e() - 1.0D);
    double d5 = -paramDouble1 * d();
    double d6 = paramc_.a + d2 * d4 - d3 * d5;
    double d7 = paramc_.c + d3 * d4 + d2 * d5;
    return new o(d6, d7, paramDouble1, paramDouble2, d2, d3);
  }
  
  protected y a(zb paramzb, zc paramzc1, zc paramzc2)
  {
    return wc.a(paramzb, paramzc1, paramzc2, this.e);
  }
  
  private void a(zb paramzb, zc paramzc1, zc paramzc2, b_ paramb_, c_ paramc_)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    int i = paramb_.c();
    y localy = a(paramzb, paramzc1, paramzc2);
    w localw2;
    double d1;
    double d2;
    double d4;
    if (!bool2) {
      if (localy.j() <= 0)
      {
        w localw1 = paramzb.c();
        localw2 = paramzb.d();
        d1 = localw1.a * (1.0D - paramb_.a()) + localw2.a * paramb_.a();
        d2 = localw1.b * (1.0D - paramb_.a()) + localw2.b * paramb_.a();
        d4 = localw2.a - localw1.a;
        double d6 = localw2.b - localw1.b;
        double d8 = Math.sqrt(d4 * d4 + d6 * d6);
        if (!bool2)
        {
          if (d8 > 0.0D)
          {
            d4 /= d8;
            d6 /= d8;
            if (bool2) {
              break label209;
            }
            if (!bool1) {}
          }
          else
          {
            d4 = 1.0D;
          }
        }
        else {
          d6 = 0.0D;
        }
        a(paramc_, d1, d2, d4, d6);
        label209:
        if ((!bool2) && (!bool1)) {
          return;
        }
      }
    }
    double d9;
    if (i < 0)
    {
      double d3 = localy.m();
      d4 = d3 * paramb_.a();
      x localx = localy.b();
      w localw4 = localx.a();
      d3 = 0.0D;
      localx.f();
      label464:
      do
      {
        if (!localx.e()) {
          break;
        }
        w localw5 = localx.a();
        d9 = localw5.a - localw4.a;
        double d10 = localw5.b - localw4.b;
        double d11 = Math.sqrt(d9 * d9 + d10 * d10);
        if (bool2) {
          break label513;
        }
        if (bool1) {
          break label511;
        }
        if (!bool2)
        {
          if (d3 + d11 >= d4)
          {
            d4 -= d3;
            d4 /= d11;
            d1 = localw4.a * (1.0D - d4) + localw5.a * d4;
            d2 = localw4.b * (1.0D - d4) + localw5.b * d4;
            if (!bool2)
            {
              if (d11 > 0.0D)
              {
                d9 /= d11;
                d10 /= d11;
                if (bool2) {
                  break label464;
                }
                if (!bool1) {}
              }
              else
              {
                d9 = 1.0D;
              }
            }
            else {
              d10 = 0.0D;
            }
            a(paramc_, d1, d2, d9, d10);
            return;
          }
          localw4 = localw5;
          d3 += d11;
          localx.f();
        }
      } while (!bool1);
      if (!bool2) {
        a(paramc_, localw4.a, localw4.b, 1.0D, 0.0D);
      }
      label511:
      if (!bool1) {}
    }
    else
    {
      label513:
      a.d.n localn = localy.a(Math.min(i, localy.j() - 2));
      localw2 = localn.d();
      w localw3 = localn.e();
      d1 = localw2.a * (1.0D - paramb_.a()) + localw3.a * paramb_.a();
      d2 = localw2.b * (1.0D - paramb_.a()) + localw3.b * paramb_.a();
      double d5 = localw3.a - localw2.a;
      double d7 = localw3.b - localw2.b;
      d9 = Math.sqrt(d5 * d5 + d7 * d7);
      if (!bool2) {
        if (d9 > 0.0D)
        {
          d5 /= d9;
          d7 /= d9;
          if (!bool2) {
            if (!bool1) {
              break label687;
            }
          }
        }
        else
        {
          d5 = 1.0D;
        }
      }
      d7 = 0.0D;
      label687:
      a(paramc_, d1, d2, d5, d7);
    }
  }
  
  void a(c_ paramc_, double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4)
  {
    double d1 = f();
    paramc_.a = (paramDouble1 - paramDouble4 * d1);
    paramc_.c = (paramDouble2 + paramDouble3 * d1);
    paramc_.e = a(paramDouble3, paramDouble4);
  }
  
  protected double a(double paramDouble1, double paramDouble2)
  {
    return Math.atan2(paramDouble2, paramDouble1);
  }
  
  public z a(wb paramwb, zb paramzb, zc paramzc1, zc paramzc2)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    z localz = new z();
    o localo1 = paramwb.d();
    c_ localc_ = new c_(null);
    y localy = a(paramzb, paramzc1, paramzc2);
    int i = 0;
    double d1 = b();
    double d2 = localo1.g();
    double d3 = localo1.h();
    o localo2 = new o(0.0D, 0.0D, d2, d3);
    localo2.a(-c());
    double d4 = localo2.a().b();
    Object localObject = localy.l();
    label480:
    label506:
    do
    {
      if (!((a.d.v)localObject).e()) {
        break;
      }
      w localw1 = ((a.d.v)localObject).a().d();
      w localw2 = ((a.d.v)localObject).a().e();
      double d5 = ((a.d.v)localObject).a().h();
      if (bool1) {
        break label532;
      }
      if (d5 > 0.1D)
      {
        double d6 = localw2.a - localw1.a;
        double d7 = localw2.b - localw1.b;
        a(localc_, localw1.a, localw1.b, d6 / d5, d7 / d5);
        b_ localb_ = new b_(0.0D, i);
        localz.add(new fc(a(d2, d3, localc_), localb_, paramwb, false));
        int j = Math.min(100, (int)Math.floor(d1 * d5 / d4));
        double d8 = j == 0 ? 1.0D : 1.0D / j;
        double d9 = d8;
        int k = 0;
        int m = j - 1;
        if (k < m) {
          a(localc_, localw1.a * (1.0D - d9) + localw2.a * d9, localw1.b * (1.0D - d9) + localw2.b * d9, d6 / d5, d7 / d5);
        }
        do
        {
          localb_ = new b_(d9, i);
          localz.add(new fc(a(d2, d3, localc_), localb_, paramwb, false));
          d9 += d8;
          k++;
          if (bool2) {
            break label506;
          }
          if (bool1) {
            break label480;
          }
          if (!bool1) {
            break;
          }
          a(localc_, localw2.a, localw2.b, d6 / d5, d7 / d5);
        } while (bool2);
        localb_ = new b_(1.0D, i);
        localz.add(new fc(a(d2, d3, localc_), localb_, paramwb, false));
      }
      ((a.d.v)localObject).f();
      i++;
    } while (!bool1);
    if (!bool2) {
      if (localz.isEmpty())
      {
        label532:
        localObject = (b_)a();
        a(paramzb, paramzc1, paramzc2, (b_)localObject, localc_);
        localz.add(new fc(a(d2, d3, localc_), localObject, paramwb, false));
      }
    }
    return localz;
  }
  
  public Object a(o paramo, zb paramzb, zc paramzc1, zc paramzc2)
  {
    return a();
  }
  
  public double a(ig paramig)
  {
    boolean bool = ld.E;
    if (!bool) {
      if (paramig == null) {
        throw new NullPointerException();
      }
    }
    tb localtb = paramig.ob();
    if (!bool) {
      if (localtb == null) {
        return 0.0D;
      }
    }
    ld localld1 = localtb.h();
    if (!bool) {
      if (localld1 == null) {
        return 0.0D;
      }
    }
    ld localld2 = localtb.g();
    if (localld2 == null) {
      return 0.0D;
    }
    return a(localtb, localld1, localld2, paramig.e());
  }
  
  public double a(zb paramzb, zc paramzc1, zc paramzc2, Object paramObject)
  {
    if (!ld.E) {
      if (!(paramObject instanceof b_)) {
        paramObject = a();
      }
    }
    b_ localb_ = (b_)paramObject;
    c_ localc_ = new c_(null);
    a(paramzb, paramzc1, paramzc2, localb_, localc_);
    return localc_.e + c();
  }
  
  public static final class d_
    implements a.e.b.c.v, a.e.b.b.n
  {
    private static final String a = "AutoRotationSliderEdgeLabelModel";
    private static final String b = "AutoRotationSliderEdgeLabelModelParameter";
    public static int c;
    
    public void a(a.e.b.b.cb paramcb)
      throws a.e.b.b.a
    {
      boolean bool = ld.E;
      Node localNode1 = paramcb.e();
      if ((bool) || ((localNode1.getNodeType() == 1) && ((bool) || ("http://www.yworks.com/xml/graphml".equals(localNode1.getNamespaceURI())))))
      {
        String str = localNode1.getLocalName();
        NamedNodeMap localNamedNodeMap;
        Node localNode2;
        double d1;
        if (!bool) {
          if ("AutoRotationSliderEdgeLabelModel".equals(str))
          {
            localNamedNodeMap = localNode1.getAttributes();
            localNode2 = localNamedNodeMap.getNamedItem("anchorRatioX");
            d1 = 0.5D;
            if (!bool) {
              if (localNode2 != null) {
                try
                {
                  d1 = Double.parseDouble(localNode2.getNodeValue());
                }
                catch (NumberFormatException localNumberFormatException1)
                {
                  d1 = 0.5D;
                }
              }
            }
            Node localNode3 = localNamedNodeMap.getNamedItem("anchorRatioY");
            double d2 = 0.5D;
            if (!bool) {
              if (localNode3 != null) {
                try
                {
                  d2 = Double.parseDouble(localNode3.getNodeValue());
                }
                catch (NumberFormatException localNumberFormatException4)
                {
                  d2 = 0.5D;
                }
              }
            }
            Node localNode5 = localNamedNodeMap.getNamedItem("angle");
            double d3 = 0.0D;
            if (!bool) {
              if (localNode5 != null) {
                try
                {
                  d3 = Double.parseDouble(localNode5.getNodeValue());
                }
                catch (NumberFormatException localNumberFormatException5)
                {
                  d3 = 0.0D;
                }
              }
            }
            Node localNode6 = localNamedNodeMap.getNamedItem("density");
            double d4 = 1.0D;
            if (!bool) {
              if (localNode6 != null) {
                try
                {
                  d4 = Double.parseDouble(localNode6.getNodeValue());
                }
                catch (NumberFormatException localNumberFormatException6)
                {
                  d4 = 1.0D;
                }
              }
            }
            Node localNode7 = localNamedNodeMap.getNamedItem("distance");
            double d5 = 0.0D;
            if ((bool) || (localNode7 != null)) {
              try
              {
                d5 = Double.parseDouble(localNode7.getNodeValue());
              }
              catch (NumberFormatException localNumberFormatException7)
              {
                d5 = 0.0D;
              }
            }
            bb localbb = new bb();
            localbb.c(d1);
            localbb.d(d2);
            localbb.b(d3);
            localbb.a(d4);
            localbb.e(d5);
            paramcb.a(localbb);
          }
        }
        if ((bool) || ((ld.D) && ("AutoRotationSliderEdgeLabelModelParameter".equals(str))))
        {
          localNamedNodeMap = localNode1.getAttributes();
          localNode2 = localNamedNodeMap.getNamedItem("ratio");
          d1 = 0.5D;
          if (!bool) {
            if (localNode2 != null) {
              try
              {
                d1 = Double.parseDouble(localNode2.getNodeValue());
              }
              catch (NumberFormatException localNumberFormatException2)
              {
                d1 = 0.5D;
              }
            }
          }
          Node localNode4 = localNamedNodeMap.getNamedItem("segment");
          int i = -1;
          if ((bool) || (localNode4 != null)) {
            try
            {
              i = Integer.parseInt(localNode4.getNodeValue());
            }
            catch (NumberFormatException localNumberFormatException3)
            {
              i = -1;
            }
          }
          paramcb.a(new bb.b_(d1, i));
        }
      }
    }
    
    public void a(eb parameb)
      throws a.e.b.c.a
    {
      boolean bool = ld.E;
      Object localObject1 = parameb.a();
      Object localObject2;
      a.e.b.c.cb localcb;
      if (!bool) {
        if ((localObject1 instanceof bb))
        {
          localObject2 = (bb)localObject1;
          localcb = parameb.e();
          localcb.a("AutoRotationSliderEdgeLabelModel", "http://www.yworks.com/xml/graphml");
          localcb.a("anchorRatioX", ((bb)localObject2).d());
          localcb.a("anchorRatioY", ((bb)localObject2).e());
          localcb.a("angle", ((bb)localObject2).c());
          localcb.a("density", ((bb)localObject2).b());
          localcb.a("distance", ((bb)localObject2).f());
          localcb.b();
          parameb.a(true);
        }
      }
      if ((bool) || ((ld.D) && ((bool) || ((localObject1 instanceof bb.b_)))))
      {
        localObject2 = (bb.b_)localObject1;
        localcb = parameb.e();
        localcb.a("AutoRotationSliderEdgeLabelModelParameter", "http://www.yworks.com/xml/graphml");
        localcb.a("ratio", ((bb.b_)localObject2).a());
        localcb.a("segment", ((bb.b_)localObject2).c());
        localcb.b();
        parameb.a(true);
      }
    }
  }
  
  private static final class c_
  {
    double a;
    double c;
    double e;
    
    private c_() {}
    
    c_(bb.0 param0)
    {
      this();
    }
  }
  
  static final class b_
  {
    private final double a;
    private final int b;
    
    b_(double paramDouble, int paramInt)
    {
      this.b = paramInt;
      this.a = paramDouble;
    }
    
    public double a()
    {
      return this.a;
    }
    
    public int c()
    {
      return this.b;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.bb

 * JD-Core Version:    0.7.0.1

 */